<template>
    <div>
        <div class="header">
            <el-input placeholder="请输入用户ID"></el-input>
            <el-input placeholder="请输入订单编号"></el-input>
            <el-input placeholder="请选择订单状态"></el-input>
            <el-button type="primary" icon="el-icon-search">查找</el-button>
            <el-button type="primary" icon="el-icon-download">导出</el-button>
        </div>
        <div class="table">
            <el-table border :data="tableData" style="width: 100%"
                :default-sort="{ prop: 'date', order: 'descending' }">
                <el-table-column prop="orderSn" label="订单编号">
                </el-table-column>
                <el-table-column prop="userId" label="用户ID"> </el-table-column>
                <el-table-column  prop="deleted" label="订单状态"></el-table-column>
                <el-table-column prop="orderPrice" label="订单金额"> </el-table-column>
                <el-table-column prop="actualPrice" label="支付金额"> </el-table-column>
                <el-table-column prop="desc" label="支付时间"> </el-table-column>
                <el-table-column prop="level" label="物流单号"> </el-table-column>
                <el-table-column prop="pid" label="物流渠道"> </el-table-column>
                <el-table-column prop="code" label="操作" width="200">
                    <div class="cell">
                        <button type="button" onclick="edit"
                            class="el-button el-button--primary el-button--mini">
                            <span>详情</span>
                        </button>
                    </div>
                </el-table-column>
            </el-table>
        </div>
        <div style="padding: 40px 0" class="footer">
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"
                :page-sizes="[10, 20, 30, 40]" :page-size="100" layout="total, sizes, prev, pager, next, jumper"
                :total="total">
            </el-pagination>
        </div>
    </div>
</template>

<script>
import { getOrdersData } from "@/api/mall";

export default {
    name: "member",
    props: [],
    data() {
        return {
            tableData: [],
            page: 1,
            limit: 20,
            keyword: "",
            userId: "",
            sort: "add_time",
            order: "desc",
            total: 10,
        };
    },
    mounted() {
        this.getData();
    },
    methods: {
        getData() {
            let data = {
                page: this.page,
                limit: this.limit,
                keyword: this.keyword,
                userId: this.userId,
                sort: this.sort,
                order: this.order,
            };
            getOrdersData(data).then((res) => {
                // console.log(res);
                if (res.errno == 0) {
                    this.tableData = res.data.items;
                    this.total = res.data.total;
                }
            });
        },
        // 一页多少条数据
        handleSizeChange(e) {
            this.limit = e;
            this.getdata();
        },
        //当前页数
        handleCurrentChange(e) {
            this.page = e;
            this.getdata();
        },
        del(data,index){
            this.data.splice(index,1)
        }
    },
};
</script>

<style scoped lang="less">
.header {
    padding: 15px;
    display: flex;
    flex-wrap: wrap;

    /deep/.el-input {
        width: 200px;
        margin-left: 15px;

        .el-input__inner {
            width: 200px;
        }
    }

    .el-button {
        margin-left: 15px;
    }
}

.table {
    padding: 15px;

    /deep/.cell {
        text-align: center;

        .border {
            display: inline-block;
            padding: 3px 8px;
            border: 1px solid #409efe;
            border-radius: 5px;
            color: #409efe;
            background-color: #e3eefb;
        }
    }
}
.cell{
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-family: Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Arial,sans-serif;
    color: #606266;
    font-size: 12px;
    border-collapse: separate;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    white-space: normal;
    word-break: break-all;
    line-height: 23px;
    padding-left: 5px;
    padding-right: 5px;
}
</style>
